import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:gourmet/color/hex.dart';
import 'package:gourmet/route/index.dart';
import 'package:gourmet/utils/colors.dart';
import 'package:gourmet/utils/styles.dart';
import 'package:pretty_qr_code/pretty_qr_code.dart';

class RecruitSuccessController extends GetxController {}

class RecruitSuccessPage extends GetView<RecruitSuccessController> {
  const RecruitSuccessPage({super.key});

  @override
  Widget build(BuildContext context) {
    return MediaQuery.removeViewPadding(
      context: context,
      removeBottom: true,
      removeLeft: true,
      removeRight: true,
      removeTop: true,
      child: Material(
        child: AnnotatedRegion<SystemUiOverlayStyle>(
          value: SystemUiOverlayStyle.dark,
          child: SingleChildScrollView(
            child: Container(
              padding: Get.mediaQuery.padding,
              height: Get.height,
              color: Colors.white,
              child: Column(
                children: [
                  Container(
                    alignment: Alignment.center,
                    padding: const EdgeInsets.only(top: 30),
                    child: Icon(
                      CupertinoIcons.checkmark_alt_circle_fill,
                      size: 80,
                      color: HexColor('#63b54b'),
                    ),
                  ),
                  Container(
                    alignment: Alignment.center,
                    padding: const EdgeInsets.only(top: 20),
                    child: Text(
                      '报名成功',
                      style: StylesUtils.customTextStyle(
                        fontSize: StylesUtils.fontSize20,
                        color: ColorsUtils.color0000,
                      ),
                    ),
                  ),
                  Container(
                    alignment: Alignment.center,
                    padding: const EdgeInsets.symmetric(vertical: 25),
                    child: SizedBox(
                      width: 308,
                      child: Text(
                        '请保持手机畅通，等待小默配送合作商的工作人员与您联系',
                        textAlign: TextAlign.center,
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color0000, lineHeight: 1.5),
                      ),
                    ),
                  ),
                  Center(
                    child: DottedBorder(
                      padding: EdgeInsets.zero,
                      color: HexColor(ColorsUtils.colorE4e4),
                      child: Container(
                        padding: const EdgeInsets.all(15),
                        constraints: const BoxConstraints.expand(
                            width: 345, height: 120),
                        child: Column(
                          children: [
                            Container(
                              alignment: Alignment.centerLeft,
                              child: Text.rich(
                                TextSpan(
                                  children: [
                                    TextSpan(
                                      text: '工作地点：',
                                      style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize15,
                                        color: ColorsUtils.color0000,
                                      ),
                                    ),
                                    TextSpan(
                                      text: '北海市海城区北海站中心公园',
                                      style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color7979,
                                        fontSize: StylesUtils.fontSize15,
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                            ),
                            Container(
                              padding: const EdgeInsets.symmetric(vertical: 20),
                              alignment: Alignment.centerLeft,
                              child: Text.rich(
                                TextSpan(
                                  children: [
                                    TextSpan(
                                      text: '报名人：',
                                      style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize15,
                                        color: ColorsUtils.color0000,
                                      ),
                                    ),
                                    TextSpan(
                                      text: '张三丰',
                                      style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color7979,
                                        fontSize: StylesUtils.fontSize15,
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                            ),
                            Container(
                              alignment: Alignment.centerLeft,
                              child: Text.rich(
                                TextSpan(
                                  children: [
                                    TextSpan(
                                      text: '联系手机：',
                                      style: StylesUtils.customTextStyle(
                                        fontSize: StylesUtils.fontSize15,
                                        color: ColorsUtils.color0000,
                                      ),
                                    ),
                                    TextSpan(
                                      text: '13612345678',
                                      style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color7979,
                                        fontSize: StylesUtils.fontSize15,
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                    ),
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: 30),
                    alignment: Alignment.center,
                    child: TextButton(
                      onPressed: () {
                        Get.offNamedUntil(Routes.home,
                            (route) => route.settings.name == Routes.home);
                      },
                      style: ButtonStyle(
                        minimumSize: const WidgetStatePropertyAll(
                          Size(235, 45),
                        ),
                        fixedSize: const WidgetStatePropertyAll(
                          Size(235, 45),
                        ),
                        overlayColor:
                            const WidgetStatePropertyAll(Colors.transparent),
                        backgroundColor:
                            const WidgetStatePropertyAll(Colors.transparent),
                        alignment: Alignment.center,
                        shape: WidgetStatePropertyAll(
                          RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(23),
                            side: BorderSide(
                              color: HexColor(ColorsUtils.colorFf64),
                            ),
                          ),
                        ),
                      ),
                      child: Text(
                        '我知道了',
                        style: StylesUtils.customTextStyle(
                          color: ColorsUtils.colorFf64,
                        ),
                      ),
                    ),
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: 30),
                    alignment: Alignment.center,
                    child: SizedBox(
                      width: 115,
                      height: 115,
                      child: PrettyQrView.data(data: 'data'),
                    ),
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: 15),
                    alignment: Alignment.center,
                    child: Text(
                      '下载小默配送APP查看更多',
                      style: StylesUtils.customTextStyle(
                        color: ColorsUtils.color9999,
                        fontSize: StylesUtils.fontSize13,
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
